﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="MucTin.ascx.cs" Inherits="MucTin" %>
<div>
    <asp:Label ID="lblMessage" runat="server"></asp:Label></div>
<div align="center">
    <table border="0" cellspacing="1" cellpadding="1" bgcolor="#cccccc">
        <tr bgcolor="#ffffff">
            <td align="left" class="SubHead" width="100">
                Mã sắp xếp<asp:Label runat="server" ID="lblId" Visible="False"></asp:Label>
            </td>
            <td align="left" class="SubHead" width="210">
                Tên nhóm
            </td>
            <td align="left" class="SubHead" style="width: 122px">
                Liên kết trực tiếp tới</td>
            <td align="left" class="SubHead" style="width: 122px">
                Chuyên mục cha
            </td>
            <td valign="top" class="SubHead" width="80">
                Sử dụng
            </td>
            <td align="left">
            </td>
        </tr>
        <tr bgcolor="#ffffff">
            <td align="left">
                <asp:TextBox ID="teDangMa" MaxLength="15" runat="server" Width="120"></asp:TextBox>
            </td>
            <td align="left">
                <asp:TextBox ID="teName" runat="server" Width="200" MaxLength="200"></asp:TextBox>
            </td>
            <td align="left" style="width: 122px">
                <asp:TextBox ID="txtDirectLink" runat="server" Width="200" MaxLength="200"></asp:TextBox>
            </td>
            <td align="left" style="width: 122px">
                <asp:DropDownList ID="cboCategory" runat="server" DataValueField="Id" DataTextField="Name"
                    CssClass="NormalTextBox" Width="122px" DataSourceID="dsParent">
                </asp:DropDownList>
            </td>
            <td align="left">
                <asp:DropDownList ID="cboStatus" runat="server" CssClass="NormalTextBox" Width="70">
                    <asp:ListItem Value="1">Có</asp:ListItem>
                    <asp:ListItem Value="0">Không</asp:ListItem>
                </asp:DropDownList>
            </td>
            <td align="left">
                <asp:LinkButton class="CommandButton" ID="cmdAdd" runat="server" Text="Cập nhật"
                    BorderStyle="none" onclick="cmdAdd_Click" style="height: 19px"></asp:LinkButton>
            </td>
        </tr>
    </table>
    <br />
    <asp:DataGrid ID="drgDataViewer" runat="server" Width="650" AllowPaging="True" AutoGenerateColumns="False"
        CellPadding="3" BackColor="White" BorderWidth="1px" BorderStyle="Solid" BorderColor="#CCCCCC"
        DataKeyField="Id" PageSize="1000" 
        onitemcommand="drgDataViewer_ItemCommand">
        <SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#669999"></SelectedItemStyle>
        <HeaderStyle Font-Bold="True" CssClass="HeaderRow"></HeaderStyle>
        <AlternatingItemStyle CssClass="DarkRow"></AlternatingItemStyle>
        <ItemStyle CssClass="LightRow"></ItemStyle>
        <Columns>
        <asp:BoundColumn DataField="id" HeaderText="id" ItemStyle-Width="250" ItemStyle-Wrap="True" ItemStyle-HorizontalAlign="left"></asp:BoundColumn>
            <asp:BoundColumn DataField="dangMa" HeaderText="Mã sắp xếp" ItemStyle-Width="250" ItemStyle-Wrap="True" ItemStyle-HorizontalAlign="left"></asp:BoundColumn>
            <asp:BoundColumn DataField="Name" HeaderText="Tên nhóm" ItemStyle-Width="250" ItemStyle-Wrap="True" ItemStyle-HorizontalAlign="left"></asp:BoundColumn>                    
            <asp:BoundColumn DataField="parentID" HeaderText="parentId" ItemStyle-Width="250" ItemStyle-Wrap="True" Visible="false" ItemStyle-HorizontalAlign="left"></asp:BoundColumn>
            <asp:BoundColumn DataField="isUsed" HeaderText="IsUsed" ItemStyle-Width="250" ItemStyle-Wrap="True" Visible="false" ItemStyle-HorizontalAlign="left"></asp:BoundColumn>
                <asp:BoundColumn DataField="SuDung" HeaderText="Sử dụng" ItemStyle-Width="250" ItemStyle-Wrap="True" ItemStyle-HorizontalAlign="left"></asp:BoundColumn>
                <asp:BoundColumn DataField="DirectLink" HeaderText="Link" ItemStyle-Width="250" ItemStyle-Wrap="True" ItemStyle-HorizontalAlign="left"></asp:BoundColumn>
            <asp:TemplateColumn HeaderText="Sửa" HeaderStyle-HorizontalAlign="center" ItemStyle-HorizontalAlign="center">
                <ItemTemplate>
                    <asp:LinkButton ID="lnkEdit" CommandName="Edit" runat="server">
                        <asp:Image ID="imgEdit" ImageUrl="../images/edit.gif" AlternateText="Sửa" runat="server" />
                    </asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateColumn>
            <asp:TemplateColumn HeaderText="Xóa" HeaderStyle-HorizontalAlign="center" ItemStyle-HorizontalAlign="center">
                <ItemTemplate>
                    <asp:LinkButton ID="lnkDelete" CommandName="Delete" runat="server">
                        <asp:Image ID="imgDelete" ImageUrl="../images/delete.gif" AlternateText="Xóa" runat="server" onclick="javascript:return confirm('Bạn có chắc muốn xóa mục này?');"/>
                    </asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateColumn>
        </Columns>
        <PagerStyle HorizontalAlign="Left" ForeColor="#000066" BackColor="White" Mode="NumericPages"
            Visible="false"></PagerStyle>
    </asp:DataGrid>
    <asp:SqlDataSource ID="ds" runat="server" ConnectionString="<%$ ConnectionStrings:DBConnectionString %>"
        ProviderName="<%$ ConnectionStrings:DBConnectionString.ProviderName %>"></asp:SqlDataSource>
</div>
<asp:SqlDataSource ID="dsParent" runat="server" 
    ConnectionString="<%$ ConnectionStrings:DBConnectionString %>" 
    ProviderName="<%$ ConnectionStrings:DBConnectionString.ProviderName %>" 
    SelectCommand="TinTuc_Nhom_GetByParent" SelectCommandType="StoredProcedure">
    <SelectParameters>
        <asp:Parameter DefaultValue="0" Name="ParentId" Type="Int32" />
        <asp:Parameter DefaultValue="1" Name="IsUsed" Type="Int32" />
    </SelectParameters>
</asp:SqlDataSource>

<style type="text/css">
.DarkRow
{
	background-color: #F4EDF7;
	font-family: Arial, Verdana, Tahoma;
	font-size: 11px;
	color: black;
	padding:4px;
}

.LightRow
{
	background-color: #DDECFE;
	font-family: Arial, Verdana, Tahoma;
	font-size: 11px;
	color: black;
	padding:4px;
}
.HeaderRow
{
	height:20px;	
	background-color:#4A7AC9;
	font-family: Arial, Verdana, Tahoma;
	font-size: 11px;
	color: white;
	font-weight: bold;
}
</style>